
<?php

class CBloqueoTable1
{

public static $instance; 



 function DrawTable($title,$sql,$campos)//obligatorio ID como campo inicial
    {
    $qu=$sql;
    
    

    
    static $search=0;
    
    if($search<1){
    echo	"<form>";						
    echo "<form id='filter-form'>Filtrar operador: <input name='filter' id='filter' value='' maxlength='30' size='30' type='text'></form><br>";
    echo "</form>";
    $search=$search+1;
    }
   
    
     echo "<div id='content_area_user_title'>";
    echo "<h2> $title</h2>";
    echo "</div>";


    echo "<div class='usersettings_statistics'>"; 
 

  echo "<table class='food_planner'>";
    
    echo "<thead>";
    echo "<tr>";    
    
                ?>
                <th>Paquete</th>
                <th>Operador</th>
                <th>Oficina</th>
                <th>Tour</th>
                <th>Fecha de inicio</th>
                <th>Fecha de finalización</th>
                <th>Estado</th>
                <th>Confirmado</th>

                
                <?php
    echo "</tr>";    
    echo "</thead>";
    
    echo "<tbody><tr style='display: table-row;'>";
    
     //echo "<table> <tbody>";


  
   
 echo "<tr class='odd'>";
 
    
    // $qu="select*from $table";
    $table=CModelo::getInstance()->getData($qu);
//var_dump($table);
    $cont=0;
    $ruta=CConfig::getInstance()->rutalocal;
    
    
    foreach($table as $campo => $valor)
    { 



$cont=$cont+1;
if($cont%2){




echo "<tr class='odd'>";
$i="";$cont=0;
foreach($valor as $id=>$val)
{ if($cont==0){$i=$val;}

echo "<td width='10%'>$val</td>";$cont=$cont+1;
}
/*---------------------------------------------------------------------------*/
// las referencias debbden de ser modificadas deacuerdo al directorio
//
/*---------------------------------------------------------------------------*/


$numpax = "select count(*) from tour_has_pasajero where tour_idTour=(SELECT TOUR_idTour from pack_has_tour where IdPackTour=$i)"; 
$numpaxa = CModelo::getInstance()->getData($numpax);

//Conteo de pasajeros del tour
foreach($numpaxa as $r=>$c){
    $table=$c;
    foreach($table as $r2=>$c2){
        $numero = $c2;
    }
    
}

$tour = "SELECT TOUR_idTour from pack_has_tour where IdPackTour=$i"; 
$idTour = CModelo::getInstance()->getData($tour);

foreach($idTour as $r=>$c){
    $table=$c;
    foreach($table as $r2=>$c2){
        $idTour = $c2;
    }
    
}

//echo "<t  d> <a href='$ruta/MDTourGeneral/CTourEdit.php?codigo=$i'>$numpaxa[0]</a>  </td>";


//echo "<td> <input type=button onClick=\"parent.location='$ruta/MDItinerary/MDEItinerary.php?codigo=$i'\" value='Buscar tour'>  </td>";
echo "<td> <a href='CEditTransporte.php?codigo=$i'> <img src='../images/edit.png' width='32' title='Editar restaurante $i'/></a> </td>";
echo "<td><a href='/christian1/modificar.php?codigo=$i'> <img src='../images/trash.png' width='32' title='Eliminar restaurante $i'/> </a> </td>";
echo "</tr>";
}
else
{

echo "<tr class='even'> ";
$i2="";$cont2=0;
foreach($valor as $id => $val)
{ if($cont2==0){$i2=$val;}
echo "<td width='10%'>$val </td>";$cont2=$cont2+1;
}

//echo "<td> <input type=button onClick=\"parent.location='$ruta/MDItinerary/MDEItinerary.php?codigo=$i2'\" value='Buscar tours'>  </td>";
echo "<td> <a href='CEditTransporte.php?codigo=$i2'> <img src='../images/edit.png' width='32' title='Editar empresa $i2'/></a> </td>";
echo "<td><a href='/christian1/modificar.php?codigo=$i2'> <img src='../images/trash.png' width='32' title='Eliminar empresa $i2'/> </a> </td>";
echo "</tr>";
}

}
echo "</td></tr></tbody></table><br><br></form>";


echo "</div>";

} 


public static function getInstance()
	{
		//echo "<div id=register-box>";
        if(self::$instance==null)
		  self::$instance=new CBloqueoTable1();
	//   echo "</div>";	  
		return  self::$instance;
	   
    
    }	


}
?>